#ifndef __SIMPLE_TREE_H___
#define __SIMPLE_TREE_H___

#include "trees.h"
#include "dynamic-tree.h"
#include <list>

using namespace std;

namespace Trees
{
	/*********************************************************************
	 *
	 *             S I M P L E    T R E E 
	 *
	 ********************************************************************/
	
	template <class V, class E>
	class SimpleTree : public DynamicTree<V,E>
	{
	public:
		SimpleTree(const V& value);
		virtual ~SimpleTree();
		const V Value() const;
		SimpleTree<V,E>* Parent() const;
		SimpleTree<V,E>* Root() const;
		const E Cost() const;
		SimpleTree<V,E>* MinCost() const;
		void Update(const E& x);
		void Link(DynamicTree<V,E>* otherRoot, const E& x);
		const E Cut();
		void Evert();
	
	private:
		E m_cost;
		SimpleTree<V,E>* m_parent;
	};

	/*********************************************************************
	 *
	 *             T R E E    A L L O C A T O R
	 *
	 ********************************************************************/
	template <class V, class E>
	class SimpleTreeAllocator : public TreeAllocator<V,E>
	{
	public:
		DynamicTree<V,E>* CreateTree(const V& value) const
		{
			return new SimpleTree<V,E>(value);
		}
	};
	
}

#endif
